<!--
 * @Descripttion:
 * @Author: zhangziyu
 * @Date: 2022-11-05 18:00:56
 * @LastEditors: cuiyingchun
 * @LastEditTime: 2022-11-06 00:41:12
 * @Introduce: 乡农课堂 搜索结果页
-->
<template>
  <div class="content">
    <el-breadcrumb separator="/" class="mb20">
      <el-breadcrumb-item :to="{ path: '/' }"><span class="gray"><i class="el-icon-s-home"></i>首页</span></el-breadcrumb-item>
      <el-breadcrumb-item><span class="green">搜索结果页</span></el-breadcrumb-item>
    </el-breadcrumb>
    <div class="classroom">
      <div class="crList" v-if="!nodata">
        <div class="crItem"  v-for="(item,index) in dataJson1" :key="index">
          <div class="imgbox">
            <img :src="item.img" alt="" srcset="" class="crImg"/>
            <span class="time">{{item.time}}</span>
          </div>
          <div class="crCon">
            <h3>{{item.title}}</h3>
            <el-row>
              <el-col :span="12" class="col1">讲师：{{item.name}}</el-col>
              <el-col :span="12" class="col2">{{item.click}}次观看</el-col>
            </el-row>
            <el-row>
              <el-tag size="medium" class="tag"  effect="dark" type="success" v-for="tag in item.tags" :key="tag">{{tag}}</el-tag>
            </el-row>
          </div>
        </div>
      </div>
      <div class="pagination" v-if="!nodata">
        <el-pagination
          class="paging"
          :current-page="page"
          :total="66"
          layout="total,prev, pager, next,jumper">
        </el-pagination>
      </div>
      <div class="nodata" v-if="nodata">
        <img :src="nodataImg" alt="" srcset="">
      </div>
    </div>
  </div>
</template>

<script>
import { dataJson1 } from './data'
export default {
  data () {
    return {
      page: 1,
      dataJson1,
      nodata: true,
      keyword: '',
      nodataImg: require('../../assets/img/default.png')
    }
  },
  mounted () {
    this.keyword = this.$route.query.word
    this.keyword ? this.nodata = true : this.nodata = false
    window.scrollTo(0, 0)
  },
  methods: {

  }
}
</script>
<style lang="scss" scoped>
.content{
  width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
  .mb20{margin-bottom: 20px;}
  .gray{color: #C2C6CC;}
  .green{
    color:#2b970d;
  }
}
.classroom{
    .crList{overflow: hidden;}
    .crItem{
      width: 224px;
      margin: 0 20px 20px 0;
      float: left;
      .imgbox{
        width: 100%;
        height: 168px;
        display:block;
        position: relative;
        .crImg{
          width: 100%;
          height: 100%;
          display:block;
        }
        .time{
          position: absolute;
          bottom: 4px;
          left: 10px;
          color: #fff;
          border-radius: 3px;
          background-color: #00000070;
          padding: 4px 5px;
          line-height: 1;
          font-size: 12px;
        }
      }
      .crCon{
        padding: 10px;
        border: 1px solid #E4E7ED;
        h3{
          height: 50px;
          font-size: 16px;
          color: #333333;
          margin: 5px 0;
        }
        .col1{
          font-size: 12px;
          margin-bottom: 10px;
        }
        .col2{
          font-size: 12px;
          color: #999999;
          text-align: right;
          margin-bottom: 10px;
        }
        .tag{
          background-color: #26840C;
          border-color: #26840C;
          height: 25px;
          line-height: 25px;
          padding: 0 6px;
          margin-right: 5px;
        }
      }
      &:nth-child(5n){
        margin-right: 0;
      }
    }
    .pagination{
      width: 100%;
      text-align: center;
      margin: 20px 0;

      .paging /deep/ .el-pager li{
        background-color: inherit;
        border: 1px solid #ddd;
        margin: 0 4px;
        color: #333333;
      }
      /deep/ .el-pagination .btn-next,/deep/ .el-pagination .btn-prev{
        border: 1px solid #ddd;
        margin: 0 4px;
      }
      .paging /deep/ .el-pager li.active{
        border-color: #2b970d;
        color: #2b970d;
      }
    }

}
.nodata{
    width: 100%;
    margin: 30px auto;
    text-align: center;
    img{
      width: 600px;
      height: 600px;
    }
  }
</style>
